home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Utilities / FWCalendar / FWCDocs / SendToBrowser.rexx < prev    next >
OS/2 REXX Batch file  |  1999-11-30  |  2KB  |  71 lines

  1. /* SendToBrowser.rexx */
  2.  
  3. parse arg SendFile
  4. if SendFile == '' then SendFile = 'index.html'
  5.  
  6. options results
  7. parse source . . . FullCallPath .
  8. ScriptDir = PathPart(FullCallPath)
  9.  
  10. if open('Browser', 'ENV:Browser') == 0 then do
  11.   address command 'REQUESTFILE >ENVARC:Browser TITLE "Locate your preferred browser:" NOICONS'
  12.   if open('Temp', 'ENVARC:Browser') then do
  13.     BrowserPath = readln('Temp')
  14.     if BrowserPath == '' then call Cleanup('ENVARC')
  15.     call close('Temp')
  16.   end
  17.   else call Cleanup('ENVARC')
  18.   address command "copy >NIL: ENVARC:Browser ENV:Browser QUIET"
  19.   if open('Temp', 'ENV:Browser') then do
  20.     if readln('Temp') ~= BrowserPath then call Cleanup('ENV')
  21.     call close('Temp')
  22.   end
  23.   else call Cleanup('ENV')
  24.   if open('Browser', 'ENV:Browser') == 0 then exit
  25. end
  26.  
  27. BrowserLoc = strip(readln('Browser'), 'B', '"')
  28. if ~exists(BrowserLoc) then exit
  29. Browser = upper(NameOnly(BrowserLoc))
  30.  
  31. select
  32.   when pos('IBROWSE', Browser) > 0 then do
  33.     URL$ = 'file://localhost/'ScriptDir''SendFile
  34.     if pos('IBROWSE', show("P")) > 0 then address 'IBROWSE' "GOTOURL "URL$
  35.     else address command 'run 'BrowserLoc' 'URL$
  36.   end
  37.  
  38.   when pos('AWEB', Browser) > 0 then do
  39.     URL$ = 'file:///'ScriptDir''SendFile
  40.     if pos('AWEB.1', show("P")) > 0 then address 'AWEB.1' "OPEN "URL$
  41.     else address command 'run 'BrowserLoc' 'URL$
  42.   end
  43.  
  44.   when Browser == 'V' then do
  45.     URL$ = 'file:///'ScriptDir''SendFile
  46.     if pos('VOYAGER', show("P")) > 0 then address 'VOYAGER' "OPENURL "URL$
  47.     else address command 'run 'BrowserLoc' 'URL$
  48.   end
  49.  
  50.   otherwise nop
  51. end
  52. exit
  53.  
  54. Cleanup:
  55.   parse arg Dest
  56.   say 'Unable to write browser information to 'Dest':Browser'
  57.   exit
  58.  
  59. /***//*******  NameOnly (NO) Subroutine  ***********/
  60. NameOnly:
  61.   parse arg FullPath
  62.   return substr(FullPath, max(lastpos(':', FullPath), lastpos('/', FullPath)) + 1)
  63. /**/
  64.  
  65. /***//*******  PathPart (PP) Subroutine  ***********/
  66. PathPart:
  67.   parse arg PP_FileWithPath
  68.   return left(PP_FileWithPath, max(lastpos(':', PP_FileWithPath), lastpos('/', PP_FileWithPath)))
  69. /**/
  70.  
  71.